package assembleTest;

import com.linkedbear.springboot.assemble.component.Bartender;
import com.linkedbear.springboot.assemble.a_module.config.TavernConfiguration;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.util.Map;
import java.util.stream.Stream;

public class TavernApplication {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(TavernConfiguration.class);
        System.out.println("--------------------------------------------");
        Stream.of(ctx.getBeanDefinitionNames()).forEach(System.out::println); //getBeanDefinitionNames(): 获取 Spring 容器中所有 Bean 的名称，返回一个字符串数组
        System.out.println("--------------------------------------------");
        Map<String, Bartender> bartenders = ctx.getBeansOfType(Bartender.class);
        bartenders.forEach((name, bartender) -> System.out.println(bartender));
    }
}
